//
//  JrdLearnCenterCellTableViewCell.m
//  v2ex-iOS
//
//  Created by longcheng on 16/6/17.
//  Copyright © 2016年 Singro. All rights reserved.
//

#import "JrdLearnCenterCell.h"
#import "JrdCommon.h"
@interface JrdLearnCenterCell(){
    NSInteger index;
}
@end
@implementation JrdLearnCenterCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        self.backgroundColor = JrdWhite1Color;//JRD_RGB(190, 190, 190);//[UIColor whiteColor];
        [self initViews];
    }
    return self;
}

- (void)initViews{
    //Account imageView and Account Username
    self.icon = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - JRD_LEARN_ICON_W), 0, JRD_LEARN_ICON_W, JRD_LEARN_ICON_W)];
    
    [self addSubview:self.icon];
    //title
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(JRD_LEARN_STA_X, 0, SCREEN_WIDTH - JRD_LEARN_STA_X - JRD_LEARN_ICON_W, 40)];
    self.titleLabel.textAlignment = NSTextAlignmentLeft;
    self.titleLabel.textColor = [UIColor blackColor];
    self.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:18.f];//font;//UIFont systemFontOfSize:18];
    [self addSubview:self.titleLabel];

    //des
    self.valueLabel = [[UILabel alloc] initWithFrame:CGRectMake(JRD_LEARN_STA_X, 40, SCREEN_WIDTH- JRD_LEARN_STA_X - JRD_LEARN_ICON_W, 50)];
    self.valueLabel.textAlignment = NSTextAlignmentLeft;
    //self.valueLabel.textColor = [UIColor blackColor];
    self.valueLabel.font = [UIFont boldSystemFontOfSize:30.f];
    [self addSubview:self.valueLabel];

    self.unitLabel = [[UILabel alloc] initWithFrame:CGRectMake(JRD_LEARN_STA_X , 40, SCREEN_WIDTH- JRD_LEARN_STA_X - JRD_LEARN_ICON_W, 50)];
    self.unitLabel.textAlignment = NSTextAlignmentLeft;
    self.unitLabel.font = [UIFont systemFontOfSize:18.f];
    self.unitLabel.textColor = JrdScoreDelColor;//[UIColor JrdScoreDelColor];
    [self addSubview:self.unitLabel];
}

- (void)updateUnitText{
    CGSize wordSize = [self.valueLabel.text sizeWithFont:self.valueLabel.font];

    [self.unitLabel setFrame:CGRectMake(self.valueLabel.frame.origin.x + wordSize.width + 5, 50, SCREEN_WIDTH- JRD_LEARN_STA_X - JRD_LEARN_ICON_W, 40)];
}
- (void)awakeFromNib {
    // Initialization code
}


@end
